<?php
require DT_CORE.'/buyhelp/common.inc.php';
defined('IN_IXDCW') or exit('Access Denied');
$navname ='buy';
$MOD['name']='买车助手_二手车';
$table = $db->getPre().'buy';

/*求购 转让 置换*/
$TYPES = explode('|', $MOD['type']);




/*乘用 商用 房车 新能源列表*/
$RANK = Pcache::read('category-'.$moduleid.'.php');
$catids = '';
foreach($RANK as $key => $val) {
	if($val['parentid'] == 4960) {
		$catids[]                   = $val['catid'];
		$arr[$key]['catid']         = $val['catid'];
		$arr[$key]['catname']       = $val['catname'];
		$arr[$key]['arrchildid']    = $val['arrchildid'];
		$arr[$key]['arr']           = $db->getAll("SELECT * FROM $table WHERE catid=".$val['catid']." and status>=2  ORDER BY edittime desc limit 8");
	}
}
$catid = implode(',',$catids);


/*筛选条件*/
$condition = "(status=3 or status=2) ";

/*默认调取 转让数据*/
if(empty($typeid))  $condition .= " AND typeid = 2";
if($catid)          $condition .= " AND catid in($catid) ";



/*图片轮播*/
$buyPic = $db->getAll("select itemid,title,thumb,edittime from $table where $condition and thumb!='' order by edittime desc limit 8");


/*最新二手车*/
$latestBuy = $db->getAll("SELECT * FROM $table WHERE $condition  ORDER BY edittime desc limit 8");




include template('buy','buyhelp');
